import {
    LoginService,
} from '@/api/index'

const state = {
    token: '',
    userInfo: {}
}

const mutations = {
    setToken(state, token) {
        state.token = token
    },
    removeToken(state) {
        state.token = token
    },

    setUserInfo(state, info) {
        state.userInfo = {
            ...info
        }
    },
    removeUserInfo(state) {
        state.userInfo = {}
    }

}

const actions = {
    // 登录
    async login(context, data) {},
    // 获取登录验证码
    async getCaptcha(context, data) {
        let res = await LoginService.captcha()
    },
    // 注销账号
    async logout(context, data) {
        // let res = await logout()
    },
}

export default {
    state,
    mutations,
    actions
}